<template>
  <div class="wzqgame">
    <div class="headerhh">
      <div @click="goBack"
           style="float: left; height: 0.98rem;">
        <a-icon type="left"
                class="icon" />
        <a class="h3">五子棋</a>
      </div>
    </div>
    <div>
      <h3 id="result-wrap">--益智五子棋--</h3>
      <canvas id="chess"
              width="450px"
              height="450px"></canvas>
      <div class="btn-wrap">
        <div id="restart"
             class="restart"
             @click="ssssss">
          <span>重新开始</span>
        </div>
        <div id="goback"
             class="goback unable"
             style="display:none">
          <span>悔棋</span>
        </div>
        <div id="return"
             class="return unable"
             style="display:none">
          <span>撤销悔棋</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { wzqfunction } from './gamejs/wzq'
export default {
  mounted () {
    wzqfunction()
  },
  inject: ['reload'],
  created () {
  },
  methods: {
    goBack: function () {
      this.$router.go(-1)
    },
    ssssss: function () {
      this.reload()
    }
  }
}
</script>

<style lang="stylus" scoped>
.headerhh {
  height: 0.98rem;
  text-align: justify;
  line-height: 0.98rem;
  padding-left: 0.3rem;
  background: #27ae9e;
}

.icon {
  font-size: 0.36rem;
  color: #fff;
  // vertical-align: -0.23rem;
  vertical-align: -0.06rem;
}

.h3 {
  display: inline-block;
  font-size: 0.36rem;
  color: #fff;
}

canvas {
  display: block;
  margin: 50px auto;
  box-shadow: -2px -2px 2px #efefef, 5px 5px 5px #b9b9b9;
  cursor: pointer;
}

.btn-wrap {
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.btn-wrap div {
  margin: 0 10px;
}

div>span {
  display: inline-block;
  padding: 10px 20px;
  color: #fff;
  background-color: #27ae9e;
  border-radius: 5px;
  cursor: pointer;
}

div.unable span {
  background: #D6D6D4;
  color: #adacaa;
}

#result-wrap {
  text-align: center;
  font-weight: bold;
  margin: 0.5rem 0;
}
</style>
